package com.example.music;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;

import com.example.lwx.R;

public class ServiceActivity extends Activity {

    Button bt_start;
    Button bt_stop;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.service);

        bt_start=findViewById(R.id.start);
        bt_stop=findViewById(R.id.stop);
        bt_start.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(ServiceActivity.this,MyService.class);
                startService(intent);
            }
        });
        bt_stop.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(ServiceActivity.this,MyService.class);
                stopService(intent);
            }
        });
    }
}
